package cn.com.assistant.service;

import cn.com.assistant.entity.User;
import cn.com.assistant.mapper.UserMapper;
import cn.com.assistant.model.UserPOJO;
import cn.com.assistant.utils.ResponseMessage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Service
public interface UserService extends IService<User> {
 
    List<User> queryAllPubUser();

    /**
     * 添加后台用户
     * @return
     */
    ResponseMessage userAdd(UserPOJO userPOJO);

    /**
     * 用户登录
     * @param username
     * @param password
     * @return
     */
    ResponseMessage userLogin(String username, String password, HttpSession session);


    ResponseMessage noToken();

    ResponseMessage noUser();

    ResponseMessage expireToken();


    ResponseMessage illegalToken();

    ResponseMessage findByToken(String token);

    /**
     * 用户名唯一性校验
     * @param username
     * @param id
     * @return
     */
    ResponseMessage existByUsername(String username, Integer id);

    /**
     * 手机号验重
     * @param phone
     * @param id
     * @return
     */
    ResponseMessage findByPhoneAndIdNot(String phone, Integer id);

    /**
     * 删除后台用户
     * @param id
     * @return
     */
    ResponseMessage userDelete(Integer id);

    /**
     * 查询单个后台用户
     * @param username
     * @return
     */
    ResponseMessage findByUserName(String username);

    /**
     * 根据id查询单个后台用户
     * @param id
     * @return
     */
    User findById(Integer id);

    /**
     * 修改用户信息
     * @param userPOJO
     * @return
     */
    ResponseMessage userUpdate(UserPOJO userPOJO);

    /**
     * 重置密码
     * @param id
     * @return
     */
    ResponseMessage userPasswordReset(Integer id);

    /**
     * 修改用户状态
     * @param id
     * @param status
     * @return
     */
    ResponseMessage userStatusReset(Integer id, int status);

    /**
     * 后台用户分页列表
     * @param page
     * @param size
     * @param filter
     * @return
     */
    ResponseMessage findByPage(Integer page, Integer size, Map<String, Object> filter);

}